package com.heima.wemedia.interceptor;


import com.heima.wemedia.service.impl.WmNewsAutoScanServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.annotation.Exchange;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.QueueBinding;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
@Slf4j
public class Mqjs {
    @Autowired
    private WmNewsAutoScanServiceImpl wmNewsAutoScanService;

    @RabbitListener(bindings = @QueueBinding(
            value = @Queue(name = "dl.ttl.queue", durable = "true"),
            exchange = @Exchange(name = "dl.ttl.direct"),
            key = "DD"
    ))
    public void tt(String mag) {
        wmNewsAutoScanService.autoScanWmNews(Integer.parseInt(mag));
        log.info("完成延迟操作");
    }


}
